<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>函数动态参数</title>
</head>

<body>
    <script>
        function getSum() {
            let sum = 0
            for (let i = 0; i < arguments.length; i++) {
                sum += arguments[i]
            }
            console.log(sum);
        }

        // arguments 是由参数组成的伪数组
        getSum(1,2,3) // 6
        getSum(1,2,3,4) // 10
    </script>
</body>

</html>